package intermediateCodeClass;

/*
    主要负责各类临时变量的产生
    以及标号的产生
 */
public class ParaGenerate {
    private String blockIndex;

    private int tempParaIndex;
    private int labelIndex;

    public String nextLabel() {
        labelIndex++;
        return "Label" + labelIndex;
    }

    public String nextPara() {
        tempParaIndex++;
        return "temp" + tempParaIndex;
    }

    private static final ParaGenerate paraGenerateInstance = new ParaGenerate();

    private ParaGenerate() {
    }

    public static ParaGenerate getInstance() {
        return paraGenerateInstance;
    }

    public void clean() {
        tempParaIndex = 0;
        labelIndex = 0;
    }
}
